

*******************************************	   
************* TABLE A35 FR Collective crimes for All Captures
*******************************************	   

clear all
clear matrix
set more off

* Data:
use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/panel_excombatientes.dta", clear 

* Class collective and individual crimes as in main analysis

g collective =.
replace collective=1 if Type_of_Crime=="Extortion" | Type_of_Crime=="Homicide"  | Type_of_Crime=="Illegal arms possession, trafficking or production" | ///
Type_of_Crime=="Illegal possession and trafficking of Military arms and ammunition" | Type_of_Crime=="Kidnapping" | Type_of_Crime=="Organized Crime" | ///
Type_of_Crime=="Rebellion" | Type_of_Crime=="Threat" | Type_of_Crime=="Drug possession, production or trafficking" |Type_of_Crime=="Property assault" |  Type_of_Crime=="Theft" |  Type_of_Crime=="Attack against authorities" |  Type_of_Crime=="Illegal use natural resources" | Type_of_Crime=="Fraud" | Type_of_Crime=="Personal assault"
replace collective=0 if collective==. & id != .

g individual =.
replace individual=1 if Type_of_Crime=="Household food assitance"  | Type_of_Crime=="Sexual Harssment" | ///
 Type_of_Crime=="Domestic violence" | Type_of_Crime=="Animal abuse" | Type_of_Crime=="Negligent injuries car accident"  | Type_of_Crime=="Use false identification"
replace individual=0 if individual==. & id != .

gen collective_crime=.
replace collective_crime=diffcaptures if collective==1
replace collective_crime=0 if collective==0 & diffcaptures!=.

eststo clear
set more off

reghdfe collective_crime gold_shock_r mean_gold_shock_r, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
summ collective_crime if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

*  + Time trends
reghdfe collective_crime gold_shock_r mean_gold_shock_r time_t, absorb(wartimenetwork year origmun ) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
summ collective_crime if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

*  + Region * Time
reghdfe collective_crime gold_shock_r mean_gold_shock_r c.time_t##i.region, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
summ collective_crime if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

*  + Municipality baseline covariate intercated with year
reghdfe collective_crime gold_shock_r mean_gold_shock_r c.time_t##i.region c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
summ collective_crime if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

* + Ex-cobatants baseline covariates
reghdfe collective_crime gold_shock_r mean_gold_shock_r age female black indigenous c.time_t##i.region c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ collective_crime if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

/* Table A15
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA15_panelA.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc %12.0fc) ///
	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
	 "\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
	   keep(gold_shock_r mean_gold_shock_r) /// Remove for table A35
	   varlabels(gold_shock_r "Economic Shock" mean_gold_shock_r "Average Shock" ) ///
	   ti("Economic Shock and Peer Effects - Collective Crimes (all Crimes)") ///	  
	   replace
*/

* Table A35
 esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA35.tex", se ///
 	   star(* 0.10 ** 0.05 *** 0.01 ) ///
 	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc %12.0fc) ///
 	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
 	 "\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
 	   varlabels(gold_shock_r "Economic Shock" mean_gold_shock_r "Average Shock" ) ///
 	   ti("Economic Shock and Peer Effects - Collective Crimes (all Crimes)") ///	  
 	   replace
	   
/*	   
eststo clear
set more off

reghdfe collective_crime gold_shock_r mean_gold_shock_r, absorb(wartimenetwork year origmun) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

*  + Time trends
reghdfe collective_crime gold_shock_r mean_gold_shock_r time_t, absorb(wartimenetwork year origmun ) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

*  + Region * Time
reghdfe collective_crime gold_shock_r mean_gold_shock_r  c.time_t##i.region, absorb(wartimenetwork year origmun ) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

*  + Municipality baseline covariate intercated with year
reghdfe collective_crime gold_shock_r mean_gold_shock_r c.time_t##i.region c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t, absorb(wartimenetwork year origmun  ) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

* + Ex-cobatants baseline covariates
reghdfe collective_crime gold_shock_r mean_gold_shock_r age female black indigenous c.time_t##i.region c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t, absorb(wartimenetwork year origmun ) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo

esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA15_panelB.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep N, fmt(%12.4fc %12.0fc)) ///
	   keep(_nl_1 ) ///
	   varlabels( _nl_1 "Peer Effect") ///
	   ti("Collective Crimes (all)- peer effect") ///	  
	   replace
